home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Developers / Selection ƒ 2.5 / pictScroll < prev    next >
Encoding:
Text File  |  1994-11-06  |  1.6 KB  |  79 lines  |  [TEXT/MSET]

  1. :class pictScroll super{ picture }
  2.     vscrollbar VScrollControl
  3.     hscrollbar HScrollControl
  4.     graphicRect frame
  5.  
  6. :m position:
  7.     get: frame { l t r b -- }
  8.     r 1- ( x) t ( y) b t - ( len) init: VScrollControl
  9.     l ( x) b 1- ( y) r l - ( len) init: HScrollControl
  10.     l t moveto: super
  11.     l t r b put: temprect 1 1 inset: temprect
  12.     get: temprect setScrollRect: VScrollControl
  13.     get: temprect setScrollRect: HScrollControl
  14.  
  15.     0 ( lo) width: super width: frame - 5 + ( hi)    putrange: HScrollControl
  16.     0 ( lo) height: super height: frame - 5 + ( hi)    putrange: VScrollControl
  17. ;m
  18.  
  19. :m classinit:
  20.     50 50 150 150 put: frame
  21.     position: self
  22.     ;m
  23.  
  24. :m draw:
  25.     get: frame { l t r b -- }
  26.     l get: HScrollControl -  ( x)
  27.     t get: VScrollControl -  ( y)  moveTo: super
  28.  
  29.     get: frame put: temprect  1 1 inset: temprect  temprect call ClipRect    draw: super
  30.     0 0 32000 32000 put: temprect  temprect call ClipRect \ no clipping
  31.     draw: frame
  32.     draw: VScrollControl
  33.     draw: HScrollControl
  34.     ;m
  35.  
  36. :m new: { wptr -- }
  37.     wptr new: super
  38.     wptr new: VScrollControl
  39.     wptr new: HScrollControl
  40.     self scrolledBy: VScrollControl
  41.     self scrolledBy: HScrollControl
  42.     position: self
  43. ;m
  44.  
  45. :m hit?:  ( -- b )
  46.     hit?: VScrollControl 
  47.     hit?: HScrollControl  or
  48. ;m
  49.  
  50. :m click:
  51.     hit?: VScrollControl IF click: VScrollControl THEN
  52.     hit?: HScrollControl IF click: HScrollControl THEN
  53. ;m
  54.  
  55. :m activate:
  56.     activate: VScrollControl
  57.     activate: HScrollControl ;m
  58.  
  59. :m deactivate:
  60.     deactivate: VScrollControl
  61.     deactivate: HScrollControl ;m
  62.  
  63. ;class
  64.  
  65. endload
  66.  
  67.  
  68. \ *** EXAMPLE USE ***
  69.  
  70. \ Make sure that the resource file Selection.rsrc
  71. \    has been placed into your Mops ƒ folder.
  72.  
  73. " Selection.rsrc" OpenResFile
  74.  
  75. selwindow w
  76. pictScroll p
  77. test: w
  78. p add: w
  79.